package com.sdx.console.evaluation.service;

import java.util.List;

import com.sdx.console.evaluation.entity.CpTaskData;
import com.sdx.console.evaluation.entity.CpTaskRule;
import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.evaluation.dao.CpTaskSetupDao;
import com.sdx.console.evaluation.entity.CpTaskSetup;
import com.ibeetl.admin.core.service.BaseService;

/**
 * 测评任务 Service
 */

@Service
@Transactional
public class CpTaskSetupService extends BaseService<CpTaskSetup>{

    @Resource
	private CpTaskSetupDao cpTaskSetupDao;

    public PageQuery<CpTaskSetup>queryByCondition(PageQuery query){
        PageQuery ret =  cpTaskSetupDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelCpTaskSetup(List<String> ids){
        try {
            cpTaskSetupDao.batchDelCpTaskSetupByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除测评任务失败", e);
        }
    }

	public List<CpTaskSetup> all() {
		return cpTaskSetupDao.all();
		}

    public  List<CpTaskData> selectGroup(Integer taskId) {
        return cpTaskSetupDao.selectGroup( taskId);
    }

    public List<CpTaskRule> selectCpTaskRule(Integer taskId) {
        return cpTaskSetupDao.selectCpTaskRule( taskId);
    }

    public List<CpTaskSetup> selectExportResult(Integer taskId) {
        return cpTaskSetupDao.selectExportResult( taskId);
    }
}